Skip to content

[Bugfix #804] vscode: don't force-create a second editor group for builder terminals - #1041

Merged
amrmelsayed merged 6 commits into
mainfrom
builder/bugfix-804
Jun 13, 2026
Merged

[Bugfix #804] vscode: don't force-create a second editor group for builder terminals#1041
amrmelsayed merged 6 commits into
mainfrom
builder/bugfix-804

Conversation

@amrmelsayed

Copy link
Copy Markdown
Collaborator

Summary

Spawning a builder (or shell) terminal unconditionally targeted vscode.ViewColumn.Two. Because that column is fixed by ordinal, VS Code force-created a second editor group whenever the user had only one open — reshaping their layout on every spawn.

openTerminal's else-branch now checks vscode.window.tabGroups.all.length:

  • Second group exists → target ViewColumn.Two (unchanged behavior).
  • Only one group → target ViewColumn.One (first/default group) instead of forcing a new group into existence.

Architect terminals (ViewColumn.One) and dev / panel terminals are untouched.

Acceptance criteria

  • ≥2 editor groups → builder terminal attaches to the second group (unchanged).
  • 1 editor group → builder terminal attaches to the first/default group, no new group created.
  • Same rule applies to shell-type terminals (they share the else branch).
  • Architect (ViewColumn.One) and dev / panel terminals untouched.
  • No new configuration setting — behavior is unconditional.
  • Existing focus / show(!focus) semantics preserved (only the target column changed).

Tests

3 source-level regression tests added to terminal-manager.test.ts, matching that file's established pattern (constructing a full TerminalManager requires heavy vscode mocking, so the suite asserts on source structure). They guard the tabGroups.all.length >= 2 gate and the Two/One fallback, and fail if the unconditional ViewColumn.Two assignment returns.

pnpm test:unit terminal-manager → 15 passed. pnpm check-types → clean. Porch checks (build + tests) → pass.

Note on related work

Per #803 (builder terminal unopenable after move-between-groups + close — same area of code), these PRs should stay sequenced. This change only touches the spawn-time column selection in the else-branch; it does not alter the move/close handling #803 addresses.

Implementation note

The issue proposed a ternary for the column selection; this PR uses an if/else instead, consistent with the codebase style guidance to avoid ternaries.

Fixes #804

🤖 Generated with Claude Code

… only if it exists

openTerminal's else-branch (builder/shell types) unconditionally targeted
vscode.ViewColumn.Two. Because that column is fixed by ordinal, VS Code
force-created a second editor group whenever the user had only one open,
reshaping their layout on every spawn.

Now the branch checks vscode.window.tabGroups.all.length: it targets
ViewColumn.Two only when a second group already exists, else falls back to
ViewColumn.One (the first/default group). Architect (ViewColumn.One) and
dev/panel terminals are untouched.

Adds 3 source-level regression tests matching this file's existing pattern.
@amrmelsayed
amrmelsayed merged commit 751246d into main Jun 13, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

vscode: don't force-create a second editor group when spawning builder terminals — attach if exists, else use the default group

1 participant